﻿<Window x:Class="PistonWheel.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:cp="http://schemas.charlespetzold.com/2007/xaml"
        Title="Piston animation" Height="550" Width="650" xmlns:my="clr-namespace:SpringMass">
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="90" />
            <RowDefinition Name="row1" Height="*"/>
        </Grid.RowDefinitions>
        <Grid.ColumnDefinitions>
            <ColumnDefinition x:Name="renderCol" Width="*" />
            <ColumnDefinition Width="300" />
        </Grid.ColumnDefinitions>

        <Grid Grid.Row="0" Grid.Column="0">
            <Grid.RowDefinitions>
                <RowDefinition />
                <RowDefinition />
            </Grid.RowDefinitions>
            <Grid.ColumnDefinitions>
                <ColumnDefinition />
            </Grid.ColumnDefinitions>
            <Label Content="Animation speed:" Grid.Column="0" Grid.Row="0" HorizontalAlignment="Center" />
            <my:TextBoxSlider MinValue="1" MaxValue="10" Value="5" Grid.Row="1" x:Name="animationSpeedSlider" VerticalAlignment="Top" HorizontalAlignment="Stretch" OnSplitterValueChanged="animationSpeedSlider_OnSplitterValueChanged" />
        </Grid>
        <Viewbox Grid.Column="0" Grid.Row="1" SizeChanged="Viewbox_SizeChanged" Name="viewbox"  >
            <Canvas Width="200" Height="400" x:Name="renderCanvas" ClipToBounds="True">
                <TextBlock Name="currPistonSpeedLbl" Text="Current piston velocity:" Canvas.Top="0.5" Canvas.Left="10" FontSize="16"/>
                <TextBlock Name="currPistonSpeed" Text="0" Canvas.Top="0" Canvas.Left="235" FontSize="18.667"/>
                <TextBlock Name="currWheelSpeedLbl" Text="Current wheel angular velocity:" Canvas.Top="25" Canvas.Left="10" FontSize="16"/>
                <TextBlock Name="currWheelSpeed" Text="0" Canvas.Top="25" Canvas.Left="235" FontSize="18.667"/>
                <Viewport3D Width="200" Height="400" Canvas.Left="0" Canvas.Top="20" Name="viewport" >
                    <Viewport3D.Camera>
                        <PerspectiveCamera x:Name="camera" Position="1,1,7" LookDirection="0,0,-1" FieldOfView="40" />
                    </Viewport3D.Camera>
                    <Viewport3D.Children>
                        <ModelVisual3D>
                            <ModelVisual3D.Content>
                                <DirectionalLight Color="#FFFFFF" Direction="-0.612372,-0.5,-0.612372" />
                            </ModelVisual3D.Content>
                        </ModelVisual3D>
                        <ModelVisual3D>
                        </ModelVisual3D>
                    </Viewport3D.Children>
                </Viewport3D>
            </Canvas>
        </Viewbox>

        <Grid Grid.Row="0" Grid.Column="1" >
            <Grid.RowDefinitions>
                <RowDefinition />
            </Grid.RowDefinitions>
            <Grid.ColumnDefinitions>
                <ColumnDefinition />
                <ColumnDefinition />
                <ColumnDefinition />
                <ColumnDefinition />
            </Grid.ColumnDefinitions>
            <Button Content="Play" Grid.Column="0" Grid.Row="0" Name="playBtn" Click="playBtn_Click" />
            <Button Content="Stop" Grid.Column="1" Grid.Row="0" Name="pauseBtn" Click="pauseBtn_Click" IsEnabled="False" />
            <Button Content="Charts" Grid.Column="2" Grid.Row="0" Name="chartsBtn" Click="chartsBtn_Click" />
            <Button Content="Clear" Grid.Column="3" Grid.Row="0" Name="clearBtn" Click="clearBtn_Click"/>
        </Grid>
        <Grid Grid.Row="1" Grid.Column="1">
            <Grid.RowDefinitions>
                <RowDefinition />
                <RowDefinition />
                <RowDefinition />
                <RowDefinition />
                <RowDefinition />
                <RowDefinition />
                <RowDefinition />
            </Grid.RowDefinitions>
            <Grid.ColumnDefinitions>
                <ColumnDefinition />
                <ColumnDefinition />
            </Grid.ColumnDefinitions>
            <Label Content="Piston mass" Grid.Row="0" Grid.Column="0" />
            <Label Content="Wheel mass" Grid.Row="1" Grid.Column="0" />
            <Label Content="Rod mass" Grid.Row="2" Grid.Column="0" />
            <Label Content="Angular velocity Ω" Grid.Row="3" Grid.Column="0" />
            <Label Content="Wheel radius R " Grid.Row="4" Grid.Column="0" />
            <Label Content="Rod's length L " Grid.Row="5" Grid.Column="0" />
            <Label Content="Rod's length error ɛ" Grid.Row="6" Grid.Column="0" />
            <my:TextBoxSlider Value="1" MinValue="0" MaxValue="5" Grid.Column="1" Grid.Row="0"  x:Name="pistonMassTextBoxSlider" VerticalAlignment="Top" OnSplitterValueChanged="pistonMassTextBoxSlider_OnSplitterValueChanged" />
            <my:TextBoxSlider Value="1" MinValue="0" MaxValue="5" Grid.Column="1" Grid.Row="1"  x:Name="wheelMassTextBoxSlider" VerticalAlignment="Top" OnSplitterValueChanged="pistonMassTextBoxSlider_OnSplitterValueChanged" />
            <my:TextBoxSlider Value="1" MinValue="0" MaxValue="5" Grid.Column="1" Grid.Row="2" x:Name="rodMassTextBoxSlider" VerticalAlignment="Top" OnSplitterValueChanged="rodMassTextBoxSlider_OnSplitterValueChanged" />
            <my:TextBoxSlider Value="1" Grid.Column="1" Grid.Row="3" x:Name="angVelocityTextBoxSlider" VerticalAlignment="Top" OnSplitterValueChanged="angVelocityTextBoxSlider_OnSplitterValueChanged" />
            <my:TextBoxSlider Value="1" MinValue="0.2" MaxValue="5.0" Grid.Column="1" Grid.Row="4" x:Name="rTextBoxSlider" VerticalAlignment="Top" OnSplitterValueChanged="rTextBoxSlider_OnSplitterValueChanged" />
            <my:TextBoxSlider Value="1" MinValue="1.0" MaxValue="7" Grid.Column="1" Grid.Row="5" x:Name="lTextBoxSlider" VerticalAlignment="Top" OnSplitterValueChanged="lTextBoxSlider_OnSplitterValueChanged" />
            <my:TextBoxSlider MinValue="0.2" MaxValue="5.0" Value="1" Grid.Column="1" Grid.Row="6" x:Name="epsilonTextBoxSlider" VerticalAlignment="Top" />
        </Grid>
    </Grid>
</Window>
